#include "StdAfx.h"

SplashScreen* Singleton<SplashScreen>::m_instance = 0;

SplashScreen::SplashScreen()
{
	HWND hDesktop = GetDesktopWindow();
	WINDOWINFO inf;
	GetWindowInfo(hDesktop, &inf);
	ui32 sizeX = inf.rcClient.right - inf.rcClient.left;
	ui32 sizeY = inf.rcClient.bottom - inf.rcClient.top;
	m_hWindow = CreateWindow("STATIC", "", WS_POPUP | SS_BITMAP, sizeX / 2 - 300, sizeY / 2 - 225, 600, 450, 0, 0, GetModuleHandle(0), 0);
	HBITMAP hBackg = LoadBitmap(GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1));
	SendMessage(m_hWindow, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBackg);
	//SetWindowPos(m_hWindow, HWND_TOPMOST, sizeX / 2 - 300, sizeY / 2 - 225, 600, 450, 0);
}

void SplashScreen::Show()
{
	ShowWindow(m_hWindow, SW_SHOW);
	UpdateWindow(m_hWindow);
}

void SplashScreen::Hide()
{
	ShowWindow(m_hWindow, SW_HIDE);
}

SplashScreen::~SplashScreen()
{
	DestroyWindow(m_hWindow);
}